package com.ahaoyou.mapper;

import com.ahaoyou.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.Collection;

/**
 * @Author LH
 * @create 2021/12/31 10:39
 */
@Mapper
@Repository
public interface UserMapper {

    /**
     * 新增用户
     * @param users
     */
    @Insert("<script> insert into user (name,sex) values" +
            "<foreach collection='users' item='item' separator=',' > " +
            "(#{item.name},#{item.sex})" +
            " </foreach> " +
            "</script>")
    void saveUser(Collection<User> users);

}